﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Unit_Test_Sample.DataStructure;
using System.Data;
using WebServicesTesting.Automation;
//using WebServicesTesting.Automation;
namespace Unit_Test_Sample.Actions
{
   public class DTO_Action
    {
        public List<Student> GetDataTableSample()
        {
            Student studentDTO = new Student();
            WCFServiceRef.Service1Client client = new WCFServiceRef.Service1Client();
            List<Student> StudentDTOList = null;
            DataSet ds = client.Display();
            DataTable dt = ds.Tables[0];
            StudentDTOList = new List<Student>();
            UnitTest help = new UnitTest();
            StudentDTOList=help.DTO_PopulateDBResults<Student>(dt);
            return StudentDTOList;
        }

        public object ComplexObjectSample()
        {
            WCFServiceRef.Service1Client client = new WCFServiceRef.Service1Client();
            return client.StudentDetails();

        }

        public List<Student> GetRollNumbers()
        {
            Student studentDTO = new Student();
            WCFServiceRef.Service1Client client= new WCFServiceRef.Service1Client();
            List<Student> StudentDTOList = new List<Student>();
            int[] rollNos = client.GetRollNumbers();

            for (int i = 0; i < rollNos.Count(); i++)
            {
                //Student s = new Student();
                Student s = Activator.CreateInstance<Student>();

                s.Roll_Number = rollNos.ElementAt(i).ToString();
                StudentDTOList.Add(s);
            }

            return StudentDTOList;
        }

    }
}
